﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
    CodeBehind="Edit.aspx.cs" Inherits="Kym.Web.Views.Messages.Edit" %>
<%@ Import Namespace="MvcContrib"%>
<%@ Import Namespace="Kym.Web.Controllers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
$(function() {
    $("#Messages").validate();
});
</script>
    <%
        using (Html.Form("Messages", "CreateOrUpdate", FormMethod.Post, new Hash(Id => "Messages")))
        {%>
    <%= Html.Hidden("Message.Id") %>
    <label for="Message.Content">Content</label>
    <%= Html.TextBox("Message.Content", new { Class = "required" })%>
    <label for="Message.Sender.Id">Sender</label>    
    <%= Html.DropDownList("Message.Sender.Id", 
        new SelectList(ViewData.Model.Contacts, "ID", "Name", ViewData.Model.Message != null ? ViewData.Model.Message.Sender.ID : 0), 
            new {Class = "required"}) %>
    <label for="Message.Receiver.Id">Receiver</label>
    <%= Html.DropDownList("Message.Receiver.Id", 
        new SelectList(ViewData.Model.Contacts, "ID", "Name", ViewData.Model.Message != null ? ViewData.Model.Message.Receiver.ID : 0),
                     new { Class = "required" })%>
    <%= Html.SubmitButton("Save", "Save") %>
    <%} %>
</asp:Content>
